import { ColumnProps } from '~/library/components/ProTable/interface'
import { getWaresCategoryListAPI } from '~/src/api/goods'
import { Procure } from '~/src/api/interface/procure'
import { stockWarnType } from '~/src/utils/serviceDict'

export const goodsTotalColumns: ColumnProps<Procure.GoodsTotal>[] = [
  { type: 'index', label: '序号', width: 60 },
  { prop: 'goodsName', label: '商品名称', minWidth: 80, align: 'center' },
  {
    prop: 'barCode',
    label: '商品编码',
    minWidth: 164,
    align: 'center',
    search: { el: 'input', placeholder: '请输入物品名称/编码/助记码/拼音码', label: '商品', key: 'content' },
  },
  // { prop: "goodsName", label: "商品名称", minWidth: 180, align: "center", search: { el: "input" } },
  // {
  //   prop: 'houseName',
  //   label: '仓库',
  //   minWidth: 130,
  //   align: 'center',
  //   enum: () => getStoreHouseAPI({ pageNumber: 1, pageSize: 999 }),
  //   isFilterEnum: false,
  //   fieldNames: { label: 'name', value: 'id' },
  //   search: { el: 'select', key: 'houseId' },
  // },
  { prop: 'quantity', label: '库存数量', minWidth: 80, align: 'center' },
  { prop: 'amount', label: '库存金额', minWidth: 80, align: 'center' },
  // { prop: "price", label: "零售价", minWidth: 80, align: "center" },
  { prop: 'costPrice', label: '成本价', minWidth: 80, align: 'center' },
  { prop: 'unitName', label: '单位', minWidth: 80, align: 'center' },
  {
    prop: 'categoryName',
    align: 'center',
    label: '商品分类',
    width: 110,
    isFilterEnum: false,
    fieldNames: { label: 'name', value: 'id' },
    enum: () => getWaresCategoryListAPI({ pageNum: 1, pageSize: 9999 }),
    search: {
      el: 'tree-select',
      key: 'categoryId',
      label: '商品分类',
    },
  },
  { prop: 'minQuantity', enum: stockWarnType, search: { el: 'select', key: 'type' }, label: '库存上限', minWidth: 80, align: 'center' },
  { prop: 'maxQuantity', label: '库存下限', minWidth: 80, align: 'center' },
]
